package com.ssy.lingxi.report.entity.report;

import javax.persistence.*;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * 会员月报表
 * @author 伍将
 * @date 2020/11/9
 * @version 2.0.0
 */
@Entity
@Table(schema = "public", name = "rep_member_month_report", indexes = {@Index(name = "rep_member_month_report_date_time_idx", columnList = "dateTime")})
public class MemberMonthReportDO implements Serializable {
    private static final long serialVersionUID = 8020713051752080826L;

    /**
     * id
     */
    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "member_month_report_seq")
    @SequenceGenerator(sequenceName = "rep_member_month_report_seq", name = "member_month_report_seq", allocationSize = 1)
    private Long id;

    /**
     * 日期时间
     */
    @Column(columnDefinition = "timestamp")
    private LocalDateTime dateTime;

    /**
     * 角色名称
     */
    @Column(columnDefinition = "varchar(50)", nullable = false)
    private String roleName;

    /**
     * 数量
     */
    @Column(columnDefinition = "int8", nullable = false)
    private Long count;

    /**
     * key：报表时间+角色名称
     */
    @Transient
    private String key;

    public String getKey() {
        return this.getDateTime() + this.getRoleName();
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public LocalDateTime getDateTime() {
        return dateTime;
    }

    public void setDateTime(LocalDateTime dateTime) {
        this.dateTime = dateTime;
    }

    public String getRoleName() {
        return roleName;
    }

    public void setRoleName(String roleName) {
        this.roleName = roleName;
    }

    public Long getCount() {
        return count;
    }

    public void setCount(Long count) {
        this.count = count;
    }
}
